/*
* Terminal.c
*
* Created: 26-04-2014 17:23:21
*  Author: Leonel
*/


#include <avr/io.h>
#include "libs/m328pSerie.h"

void configs();



int main(void)
{
	/*
	 *	Set Configurations
	 */
	configs();
	
	
	/*
	 *	Initialize Variables
	 */
	char *cmd = NULL;
	
	
	/*
	 *	Program Cycle
	 */
	for(;;){
		
		
		/*
		 *	Check for user commands
		 */
		if( (cmd = m328pGetSerialCommand())){
			switch(*cmd){
				
				// version
				case 'v':
				case 'V': 
					m328pSendString("Version 0.1");
					break;
				
				// help
				case '?':
					m328pSendString("----- Project CCat -----\n");
					m328pSendString("(v) - software version\n");
					m328pSendString("(?) - help\n");
					m328pSendString("------------------------");
					break;
				
				default:
					m328pSendString("Uknw: ");
					m328pSendString(cmd);
			}
			
			// new line
			m328pSendString("\n\n");
		}
	}
}






/************************************************************************/
/* Atmega328p board configurations                                      */
/************************************************************************/
void configs() {
	
	/*
	 *	Serial Communication
	 */
	m328pSerialConfig(B9600);
	
	
	#if DEBUG
		m328pSendString("Communication ON\n\n");
	#endif
	
}